/*
 * Kinect Player
 * Kulikov Victor
 * kulikov.victor@gmail.com
 * GNU Lisence 2011
 */
#ifndef GLKINECTVIEW_H
#define GLKINECTVIEW_H

#include <QGLWidget>

#include <opencv2/core/core.hpp>
#include <Kinect/kinectframe.h>
using namespace cv;
namespace kinect
{
/*! Qt implementation of libfreenect Could view
  */
class GLKinectView : public QGLWidget
{
Q_OBJECT
public:
    explicit GLKinectView(QWidget *parent = 0);

signals:

public slots:
    void reciveFrame(KinectFrame frame);
    void setXRotation(int angle);
    void setYRotation(int angle);
    void setZRotation(int angle);
protected:
     void initializeGL();
     void paintGL();
     void resizeGL(int width, int height);
     void mousePressEvent(QMouseEvent *event);
     void mouseMoveEvent(QMouseEvent *event);
     void wheelEvent(QWheelEvent * event);
private:
     void normalizeAngle(int *angle);
     void LoadRGBMatrix();
     void LoadVertexMatrix();
     GLuint gl_rgb_tex;
     Mat _rgb,_depth;
     float zoom;
     QPoint lastPos;
     int xRot;
     int yRot;
     int zRot;
};
}
#endif // GLKINECTVIEW_H
